(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
plus(x, y) → plusIter(x, y, 0)
plusIter(x, y, z) → ifPlus(le(x, z), x, y, z)
ifPlus(true, x, y, z) → y
ifPlus(false, x, y, z) → plusIter(x, s(y), s(z))
le(s(x), 0) → false
le(0, y) → true
le(s(x), s(y)) → le(x, y)
sum(xs) → sumIter(xs, 0)
sumIter(xs, x) → ifSum(isempty(xs), xs, x, plus(x, head(xs)))
ifSum(true, xs, x, y) → x
ifSum(false, xs, x, y) → sumIter(tail(xs), y)
isempty(nil) → true
isempty(cons(x, xs)) → false
head(nil) → error
head(cons(x, xs)) → x
tail(nil) → nil
tail(cons(x, xs)) → xs
a → b
a → c
Rewrite Strategy: FULL
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
plus(x, y) → plusIter(x, y, 0')
plusIter(x, y, z) → ifPlus(le(x, z), x, y, z)
ifPlus(true, x, y, z) → y
ifPlus(false, x, y, z) → plusIter(x, s(y), s(z))
le(s(x), 0') → false
le(0', y) → true
le(s(x), s(y)) → le(x, y)
sum(xs) → sumIter(xs, 0')
sumIter(xs, x) → ifSum(isempty(xs), xs, x, plus(x, head(xs)))
ifSum(true, xs, x, y) → x
ifSum(false, xs, x, y) → sumIter(tail(xs), y)
isempty(nil) → true
isempty(cons(x, xs)) → false
head(nil) → error
head(cons(x, xs)) → x
tail(nil) → nil
tail(cons(x, xs)) → xs
a → b
a → c
S is empty.
Rewrite Strategy: FULL
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
TRS:
Rules:
plus(x, y) → plusIter(x, y, 0')
plusIter(x, y, z) → ifPlus(le(x, z), x, y, z)
ifPlus(true, x, y, z) → y
ifPlus(false, x, y, z) → plusIter(x, s(y), s(z))
le(s(x), 0') → false
le(0', y) → true
le(s(x), s(y)) → le(x, y)
sum(xs) → sumIter(xs, 0')
sumIter(xs, x) → ifSum(isempty(xs), xs, x, plus(x, head(xs)))
ifSum(true, xs, x, y) → x
ifSum(false, xs, x, y) → sumIter(tail(xs), y)
isempty(nil) → true
isempty(cons(x, xs)) → false
head(nil) → error
head(cons(x, xs)) → x
tail(nil) → nil
tail(cons(x, xs)) → xs
a → b
a → c
Types:
plus :: 0':s:error → 0':s:error → 0':s:error
plusIter :: 0':s:error → 0':s:error → 0':s:error → 0':s:error
0' :: 0':s:error
ifPlus :: true:false → 0':s:error → 0':s:error → 0':s:error → 0':s:error
le :: 0':s:error → 0':s:error → true:false
true :: true:false
false :: true:false
s :: 0':s:error → 0':s:error
sum :: nil:cons → 0':s:error
sumIter :: nil:cons → 0':s:error → 0':s:error
ifSum :: true:false → nil:cons → 0':s:error → 0':s:error → 0':s:error
isempty :: nil:cons → true:false
head :: nil:cons → 0':s:error
tail :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s:error → nil:cons → nil:cons
error :: 0':s:error
a :: b:c
b :: b:c
c :: b:c
hole_0':s:error1_0 :: 0':s:error
hole_true:false2_0 :: true:false
hole_nil:cons3_0 :: nil:cons
hole_b:c4_0 :: b:c
gen_0':s:error5_0 :: Nat → 0':s:error
gen_nil:cons6_0 :: Nat → nil:cons
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
plusIter,
le,
sumIterThey will be analysed ascendingly in the following order:
le < plusIter
(6) Obligation:
TRS:
Rules:
plus(
x,
y) →
plusIter(
x,
y,
0')
plusIter(
x,
y,
z) →
ifPlus(
le(
x,
z),
x,
y,
z)
ifPlus(
true,
x,
y,
z) →
yifPlus(
false,
x,
y,
z) →
plusIter(
x,
s(
y),
s(
z))
le(
s(
x),
0') →
falsele(
0',
y) →
truele(
s(
x),
s(
y)) →
le(
x,
y)
sum(
xs) →
sumIter(
xs,
0')
sumIter(
xs,
x) →
ifSum(
isempty(
xs),
xs,
x,
plus(
x,
head(
xs)))
ifSum(
true,
xs,
x,
y) →
xifSum(
false,
xs,
x,
y) →
sumIter(
tail(
xs),
y)
isempty(
nil) →
trueisempty(
cons(
x,
xs)) →
falsehead(
nil) →
errorhead(
cons(
x,
xs)) →
xtail(
nil) →
niltail(
cons(
x,
xs)) →
xsa →
ba →
cTypes:
plus :: 0':s:error → 0':s:error → 0':s:error
plusIter :: 0':s:error → 0':s:error → 0':s:error → 0':s:error
0' :: 0':s:error
ifPlus :: true:false → 0':s:error → 0':s:error → 0':s:error → 0':s:error
le :: 0':s:error → 0':s:error → true:false
true :: true:false
false :: true:false
s :: 0':s:error → 0':s:error
sum :: nil:cons → 0':s:error
sumIter :: nil:cons → 0':s:error → 0':s:error
ifSum :: true:false → nil:cons → 0':s:error → 0':s:error → 0':s:error
isempty :: nil:cons → true:false
head :: nil:cons → 0':s:error
tail :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s:error → nil:cons → nil:cons
error :: 0':s:error
a :: b:c
b :: b:c
c :: b:c
hole_0':s:error1_0 :: 0':s:error
hole_true:false2_0 :: true:false
hole_nil:cons3_0 :: nil:cons
hole_b:c4_0 :: b:c
gen_0':s:error5_0 :: Nat → 0':s:error
gen_nil:cons6_0 :: Nat → nil:cons
Generator Equations:
gen_0':s:error5_0(0) ⇔ 0'
gen_0':s:error5_0(+(x, 1)) ⇔ s(gen_0':s:error5_0(x))
gen_nil:cons6_0(0) ⇔ nil
gen_nil:cons6_0(+(x, 1)) ⇔ cons(0', gen_nil:cons6_0(x))
The following defined symbols remain to be analysed:
le, plusIter, sumIter
They will be analysed ascendingly in the following order:
le < plusIter
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
le(
gen_0':s:error5_0(
+(
1,
n8_0)),
gen_0':s:error5_0(
n8_0)) →
false, rt ∈ Ω(1 + n8
0)
Induction Base:
le(gen_0':s:error5_0(+(1, 0)), gen_0':s:error5_0(0)) →RΩ(1)
false
Induction Step:
le(gen_0':s:error5_0(+(1, +(n8_0, 1))), gen_0':s:error5_0(+(n8_0, 1))) →RΩ(1)
le(gen_0':s:error5_0(+(1, n8_0)), gen_0':s:error5_0(n8_0)) →IH
false
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
TRS:
Rules:
plus(
x,
y) →
plusIter(
x,
y,
0')
plusIter(
x,
y,
z) →
ifPlus(
le(
x,
z),
x,
y,
z)
ifPlus(
true,
x,
y,
z) →
yifPlus(
false,
x,
y,
z) →
plusIter(
x,
s(
y),
s(
z))
le(
s(
x),
0') →
falsele(
0',
y) →
truele(
s(
x),
s(
y)) →
le(
x,
y)
sum(
xs) →
sumIter(
xs,
0')
sumIter(
xs,
x) →
ifSum(
isempty(
xs),
xs,
x,
plus(
x,
head(
xs)))
ifSum(
true,
xs,
x,
y) →
xifSum(
false,
xs,
x,
y) →
sumIter(
tail(
xs),
y)
isempty(
nil) →
trueisempty(
cons(
x,
xs)) →
falsehead(
nil) →
errorhead(
cons(
x,
xs)) →
xtail(
nil) →
niltail(
cons(
x,
xs)) →
xsa →
ba →
cTypes:
plus :: 0':s:error → 0':s:error → 0':s:error
plusIter :: 0':s:error → 0':s:error → 0':s:error → 0':s:error
0' :: 0':s:error
ifPlus :: true:false → 0':s:error → 0':s:error → 0':s:error → 0':s:error
le :: 0':s:error → 0':s:error → true:false
true :: true:false
false :: true:false
s :: 0':s:error → 0':s:error
sum :: nil:cons → 0':s:error
sumIter :: nil:cons → 0':s:error → 0':s:error
ifSum :: true:false → nil:cons → 0':s:error → 0':s:error → 0':s:error
isempty :: nil:cons → true:false
head :: nil:cons → 0':s:error
tail :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s:error → nil:cons → nil:cons
error :: 0':s:error
a :: b:c
b :: b:c
c :: b:c
hole_0':s:error1_0 :: 0':s:error
hole_true:false2_0 :: true:false
hole_nil:cons3_0 :: nil:cons
hole_b:c4_0 :: b:c
gen_0':s:error5_0 :: Nat → 0':s:error
gen_nil:cons6_0 :: Nat → nil:cons
Lemmas:
le(gen_0':s:error5_0(+(1, n8_0)), gen_0':s:error5_0(n8_0)) → false, rt ∈ Ω(1 + n80)
Generator Equations:
gen_0':s:error5_0(0) ⇔ 0'
gen_0':s:error5_0(+(x, 1)) ⇔ s(gen_0':s:error5_0(x))
gen_nil:cons6_0(0) ⇔ nil
gen_nil:cons6_0(+(x, 1)) ⇔ cons(0', gen_nil:cons6_0(x))
The following defined symbols remain to be analysed:
plusIter, sumIter
(10) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol plusIter.
(11) Obligation:
TRS:
Rules:
plus(
x,
y) →
plusIter(
x,
y,
0')
plusIter(
x,
y,
z) →
ifPlus(
le(
x,
z),
x,
y,
z)
ifPlus(
true,
x,
y,
z) →
yifPlus(
false,
x,
y,
z) →
plusIter(
x,
s(
y),
s(
z))
le(
s(
x),
0') →
falsele(
0',
y) →
truele(
s(
x),
s(
y)) →
le(
x,
y)
sum(
xs) →
sumIter(
xs,
0')
sumIter(
xs,
x) →
ifSum(
isempty(
xs),
xs,
x,
plus(
x,
head(
xs)))
ifSum(
true,
xs,
x,
y) →
xifSum(
false,
xs,
x,
y) →
sumIter(
tail(
xs),
y)
isempty(
nil) →
trueisempty(
cons(
x,
xs)) →
falsehead(
nil) →
errorhead(
cons(
x,
xs)) →
xtail(
nil) →
niltail(
cons(
x,
xs)) →
xsa →
ba →
cTypes:
plus :: 0':s:error → 0':s:error → 0':s:error
plusIter :: 0':s:error → 0':s:error → 0':s:error → 0':s:error
0' :: 0':s:error
ifPlus :: true:false → 0':s:error → 0':s:error → 0':s:error → 0':s:error
le :: 0':s:error → 0':s:error → true:false
true :: true:false
false :: true:false
s :: 0':s:error → 0':s:error
sum :: nil:cons → 0':s:error
sumIter :: nil:cons → 0':s:error → 0':s:error
ifSum :: true:false → nil:cons → 0':s:error → 0':s:error → 0':s:error
isempty :: nil:cons → true:false
head :: nil:cons → 0':s:error
tail :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s:error → nil:cons → nil:cons
error :: 0':s:error
a :: b:c
b :: b:c
c :: b:c
hole_0':s:error1_0 :: 0':s:error
hole_true:false2_0 :: true:false
hole_nil:cons3_0 :: nil:cons
hole_b:c4_0 :: b:c
gen_0':s:error5_0 :: Nat → 0':s:error
gen_nil:cons6_0 :: Nat → nil:cons
Lemmas:
le(gen_0':s:error5_0(+(1, n8_0)), gen_0':s:error5_0(n8_0)) → false, rt ∈ Ω(1 + n80)
Generator Equations:
gen_0':s:error5_0(0) ⇔ 0'
gen_0':s:error5_0(+(x, 1)) ⇔ s(gen_0':s:error5_0(x))
gen_nil:cons6_0(0) ⇔ nil
gen_nil:cons6_0(+(x, 1)) ⇔ cons(0', gen_nil:cons6_0(x))
The following defined symbols remain to be analysed:
sumIter
(12) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol sumIter.
(13) Obligation:
TRS:
Rules:
plus(
x,
y) →
plusIter(
x,
y,
0')
plusIter(
x,
y,
z) →
ifPlus(
le(
x,
z),
x,
y,
z)
ifPlus(
true,
x,
y,
z) →
yifPlus(
false,
x,
y,
z) →
plusIter(
x,
s(
y),
s(
z))
le(
s(
x),
0') →
falsele(
0',
y) →
truele(
s(
x),
s(
y)) →
le(
x,
y)
sum(
xs) →
sumIter(
xs,
0')
sumIter(
xs,
x) →
ifSum(
isempty(
xs),
xs,
x,
plus(
x,
head(
xs)))
ifSum(
true,
xs,
x,
y) →
xifSum(
false,
xs,
x,
y) →
sumIter(
tail(
xs),
y)
isempty(
nil) →
trueisempty(
cons(
x,
xs)) →
falsehead(
nil) →
errorhead(
cons(
x,
xs)) →
xtail(
nil) →
niltail(
cons(
x,
xs)) →
xsa →
ba →
cTypes:
plus :: 0':s:error → 0':s:error → 0':s:error
plusIter :: 0':s:error → 0':s:error → 0':s:error → 0':s:error
0' :: 0':s:error
ifPlus :: true:false → 0':s:error → 0':s:error → 0':s:error → 0':s:error
le :: 0':s:error → 0':s:error → true:false
true :: true:false
false :: true:false
s :: 0':s:error → 0':s:error
sum :: nil:cons → 0':s:error
sumIter :: nil:cons → 0':s:error → 0':s:error
ifSum :: true:false → nil:cons → 0':s:error → 0':s:error → 0':s:error
isempty :: nil:cons → true:false
head :: nil:cons → 0':s:error
tail :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s:error → nil:cons → nil:cons
error :: 0':s:error
a :: b:c
b :: b:c
c :: b:c
hole_0':s:error1_0 :: 0':s:error
hole_true:false2_0 :: true:false
hole_nil:cons3_0 :: nil:cons
hole_b:c4_0 :: b:c
gen_0':s:error5_0 :: Nat → 0':s:error
gen_nil:cons6_0 :: Nat → nil:cons
Lemmas:
le(gen_0':s:error5_0(+(1, n8_0)), gen_0':s:error5_0(n8_0)) → false, rt ∈ Ω(1 + n80)
Generator Equations:
gen_0':s:error5_0(0) ⇔ 0'
gen_0':s:error5_0(+(x, 1)) ⇔ s(gen_0':s:error5_0(x))
gen_nil:cons6_0(0) ⇔ nil
gen_nil:cons6_0(+(x, 1)) ⇔ cons(0', gen_nil:cons6_0(x))
No more defined symbols left to analyse.
(14) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
le(gen_0':s:error5_0(+(1, n8_0)), gen_0':s:error5_0(n8_0)) → false, rt ∈ Ω(1 + n80)
(15) BOUNDS(n^1, INF)
(16) Obligation:
TRS:
Rules:
plus(
x,
y) →
plusIter(
x,
y,
0')
plusIter(
x,
y,
z) →
ifPlus(
le(
x,
z),
x,
y,
z)
ifPlus(
true,
x,
y,
z) →
yifPlus(
false,
x,
y,
z) →
plusIter(
x,
s(
y),
s(
z))
le(
s(
x),
0') →
falsele(
0',
y) →
truele(
s(
x),
s(
y)) →
le(
x,
y)
sum(
xs) →
sumIter(
xs,
0')
sumIter(
xs,
x) →
ifSum(
isempty(
xs),
xs,
x,
plus(
x,
head(
xs)))
ifSum(
true,
xs,
x,
y) →
xifSum(
false,
xs,
x,
y) →
sumIter(
tail(
xs),
y)
isempty(
nil) →
trueisempty(
cons(
x,
xs)) →
falsehead(
nil) →
errorhead(
cons(
x,
xs)) →
xtail(
nil) →
niltail(
cons(
x,
xs)) →
xsa →
ba →
cTypes:
plus :: 0':s:error → 0':s:error → 0':s:error
plusIter :: 0':s:error → 0':s:error → 0':s:error → 0':s:error
0' :: 0':s:error
ifPlus :: true:false → 0':s:error → 0':s:error → 0':s:error → 0':s:error
le :: 0':s:error → 0':s:error → true:false
true :: true:false
false :: true:false
s :: 0':s:error → 0':s:error
sum :: nil:cons → 0':s:error
sumIter :: nil:cons → 0':s:error → 0':s:error
ifSum :: true:false → nil:cons → 0':s:error → 0':s:error → 0':s:error
isempty :: nil:cons → true:false
head :: nil:cons → 0':s:error
tail :: nil:cons → nil:cons
nil :: nil:cons
cons :: 0':s:error → nil:cons → nil:cons
error :: 0':s:error
a :: b:c
b :: b:c
c :: b:c
hole_0':s:error1_0 :: 0':s:error
hole_true:false2_0 :: true:false
hole_nil:cons3_0 :: nil:cons
hole_b:c4_0 :: b:c
gen_0':s:error5_0 :: Nat → 0':s:error
gen_nil:cons6_0 :: Nat → nil:cons
Lemmas:
le(gen_0':s:error5_0(+(1, n8_0)), gen_0':s:error5_0(n8_0)) → false, rt ∈ Ω(1 + n80)
Generator Equations:
gen_0':s:error5_0(0) ⇔ 0'
gen_0':s:error5_0(+(x, 1)) ⇔ s(gen_0':s:error5_0(x))
gen_nil:cons6_0(0) ⇔ nil
gen_nil:cons6_0(+(x, 1)) ⇔ cons(0', gen_nil:cons6_0(x))
No more defined symbols left to analyse.
(17) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
le(gen_0':s:error5_0(+(1, n8_0)), gen_0':s:error5_0(n8_0)) → false, rt ∈ Ω(1 + n80)
(18) BOUNDS(n^1, INF)